<template>
  <div class="depart-item">
    <div class="title">{{ data.departName }}</div>
    <div class="setting">
      <Dropdown transfer stop-propagation>
        <Icon type="md-settings" />
        <DropdownMenu slot="list">
          <DropdownItem @click.native="emitAction('create')">{{ $t("staffIndex.staffDepartmentAddChild") }}</DropdownItem>
          <DropdownItem @click.native="emitAction('update')">{{ $t("staffIndex.staffDepartmentAddChildEdit") }}</DropdownItem>
          <DropdownItem v-show="data.parentId!='0'" @click.native="emitAction('del')">{{ $t("staffIndex.staffDepartmentAddChildDel") }}</DropdownItem>
        </DropdownMenu>
      </Dropdown>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: Object,
  },
  // created () {
  //   console.log('部门删除',this.data)
  // },
  methods: {
    emitAction (name) {
      this.$emit('action', name)
    },
  },
}
</script>

<style lang="less" scoped>
.depart-item {
  display: flex;
  line-height: 28px;

  .title {
    flex: 1;
    .wrap();
  }
  .setting {
    flex-shrink: 0;
  }
}
</style>
